#ifndef _PARSER_H
#define _PARSER_H

#include "http.h"
#define RETRY_TIME			23
#define NORMAL_BUFFER_SIZE	1024*1024

#define	ERROR_NO_MEMORY		-1
#define	ERROR_INIT_HTTP		-2
#define	ERROR_DOWNLOAD_HTTP	-3

struct download_task
{
	int error;
	int size;
	int position;
	char *buffer;
	char *url;
	struct http_task *http;
};

struct stock_code
{
	char code[16];
	char name[32];
};

int init_download_task(struct download_task *task, char *url);
int download(struct download_task *task);
void cancel_download(struct download_task *task);
void free_download_task(struct download_task *task);

struct stock_code *get_shanghai_stock(int index);
struct stock_code *get_shenzhen_stock(int index);

#endif
